package cn.iocoder.yudao.module.famous.doctor.dal.mysql.prescription;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.prescription.PrescriptionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.prescription.vo.*;

/**
 * 药方统计 Mapper
 *
 * @author 档案
 */
@Mapper
public interface PrescriptionMapper extends BaseMapperX<PrescriptionDO> {

    default PageResult<PrescriptionDO> selectPage(PrescriptionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PrescriptionDO>()
                .betweenIfPresent(PrescriptionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PrescriptionDO::getTitle, reqVO.getTitle())
                .eqIfPresent(PrescriptionDO::getContent, reqVO.getContent())
                .eqIfPresent(PrescriptionDO::getUseNum, reqVO.getUseNum())
                .eqIfPresent(PrescriptionDO::getIllnessNum, reqVO.getIllnessNum())
                .eqIfPresent(PrescriptionDO::getIllnessLabel, reqVO.getIllnessLabel())
                .orderByDesc(PrescriptionDO::getId));
    }

    default List<PrescriptionDO> selectList(PrescriptionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PrescriptionDO>()
                .betweenIfPresent(PrescriptionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PrescriptionDO::getTitle, reqVO.getTitle())
                .eqIfPresent(PrescriptionDO::getContent, reqVO.getContent())
                .eqIfPresent(PrescriptionDO::getUseNum, reqVO.getUseNum())
                .eqIfPresent(PrescriptionDO::getIllnessNum, reqVO.getIllnessNum())
                .eqIfPresent(PrescriptionDO::getIllnessLabel, reqVO.getIllnessLabel())
                .orderByDesc(PrescriptionDO::getId));
    }

}
